#if !defined(EA_50DD2D87_EEF2_4805_A5F3_D4E674331F44__INCLUDED_)
#define EA_50DD2D87_EEF2_4805_A5F3_D4E674331F44__INCLUDED_

#include "Client.h"
#include "Date.h"
#include "Item.h"
#include <fstream>

#include <string>

class Transaction {
public:
	Transaction() {}
	Transaction(Date _date, string _starterID, string _enderID): date(_date), starterID(_starterID), enderID(_enderID), hasEnded(false) {}
	Transaction(Date _date, string _starterID, string _enderID, bool _hasEnded): date(_date), starterID(_starterID), enderID(_enderID), hasEnded(_hasEnded) {}
	virtual ~Transaction() {}

	/** @return the transaction's date */
	Date getDate() const { return date; }

	/** @return the transaction's state */
	bool getHasEnded() const { return hasEnded; }

	/** @return the ID of the client who started the transaction */
	string getClientStarter() const { return starterID; }

	/** @return the ID of the client who finished the transaction */
	string getClientEnder() const { return enderID; }

	/** Sets date equal to d */
	void setDate(Date d) { date = d; }

	/** Sets hasEnded equal to _hasEnded */
	void setHasEnded(bool _hasEnded) { hasEnded = _hasEnded; }

	/** Sets enderID equal to c */
	void setClientEnder(string c) { enderID = c; }

	/** Sets starterID equal to s */
	void setClientStarter(string s){ starterID=s; }

	/** Adds the transaction's data to the records filename */
	virtual void save(string filename, ofstream & out) {}

	/** Shows the information about the transaction */
	virtual void showTransaction(){}

	/** @return ID of transaction */
	virtual string getID() const=0;

	/** @return items of transaction */
	virtual vector<Item> getItems() const=0;

	/** sets items of transaction equal to _items */
	virtual void setItemsOwner(vector<Item> & _items) {}

protected:
	Date date;
	string starterID;
	string enderID;
	bool hasEnded;

};
#endif // !defined(EA_50DD2D87_EEF2_4805_A5F3_D4E674331F44__INCLUDED_)
